DROP PROCEDURE ReadWordLibraryProc 

ALTER PROCEDURE ReadWordLibraryProc 
	@Language nvarchar(50)
AS
BEGIN
	DECLARE @nbrOfRows int = 0;
	SELECT @nbrOfRows = COUNT(*) FROM ForeignLanguages WHERE Name = @Language;

	IF (@nbrOfRows > 0)
	BEGIN
		SELECT sw.WordID, sw.SwedishWordText, flw.ForeignWordText, fl.Name, sw.Description
		FROM SwedishWords sw 
			JOIN ForeignLanguageWords flw ON sw.WordID=flw.WordID
			JOIN ForeignLanguages fl ON flw.ForeignLanguageID=fl.ForeignLanguageID
		WHERE fl.Name = @Language;
	END
	ELSE
		PRINT 'No language found with the name ' +@Language;
END

EXEC ReadWordLibraryProc 'English';
